﻿using ComLib;
using ComLib.ConfigService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IPCPages
{
    public partial class frmReg : Form
    {
        public frmReg(string machineCode)
        {
            InitializeComponent();
            txbMachineCode.Text = machineCode;
        }

        private void btnNo_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txbRegCode.Text))
            {
                MessageBox.Show("请输入注册码");
                return;
            }
            string machineCode = txbMachineCode.Text;
            if (RegCodeCheck.CheckRegCode(txbRegCode.Text, ref machineCode))
            {
                IniConfigFile.WriteValue("Info", "kc", txbRegCode.Text, "");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("注册码错误");
            }
        }
    }
}
